package demo11;

public class TestBinarySortTree {
    public static void main(String[] args) {
        int[] arr = new int[]{7,3,10,12,5,1,9};
        //创建一颗二叉排序树
        BinarySortTree bst = new BinarySortTree();
        //循环添加
        for (int i : arr){
            bst.add(new Node(i));
        }
        //中序遍历
        bst.midShow();
        System.out.println(">>>>>>>>>>>>>>>>>>>>>");
        //查找
        Node node = bst.search(10);
        System.out.println(node.value);
        Node node2 = bst.search(111);
        System.out.println(node2);
        //查找父节点
        Node p1 = bst.searchParent(10);
        System.out.println(p1.value);
        System.out.println(">>>>>>>>>>>>>>>>>>>>>");
        bst.delete(10);
        bst.midShow();
    }
}
